package blueBridge;

import java.util.Scanner;

public class MainD {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        boolean[][] black = new boolean[n][n];
        int m = in.nextInt();

        for(int i=0;i<m;i++){
            int x1 = in.nextInt();
            int y1 = in.nextInt();
            int x2 = in.nextInt();
            int y2 = in.nextInt();

            for(int a = x1-1;a<=x2-1;a++){
                for(int b = y1-1;b<=y2-1;b++){
                    black[a][b] = !black[a][b];
                }
            }
        }

        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++){
                System.out.print(black[i][j]?1:0);
            }
            System.out.println();
        }
    }
}
